home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1 / Ian and Stuart's One (Australia).iso / Australasian Legends / Commercial / Rainbow Hill / MacDOS™ 2.0.0 / User's Guide / 13.3 LOG - READ < prev    next >
Text File  |  1994-09-20  |  20KB  |  637 lines

  1. LOG
  2.        captures MacDOS commands and their output.
  3.  
  4.    Syntax
  5.        log [[file] [/A] [/O] | [/-]]
  6.  
  7.    Parameters
  8.        file
  9.        is  the file to be used for storing captured information. It
  10.        can  include a volume and path spec. If file is missing, LOG
  11.        closes the current logging file and stops logging.
  12.  
  13.    Switches
  14.        /A
  15.        appends  logging  data  to  the requested  file  instead  of
  16.        overwriting it.
  17.  
  18.        /O
  19.        captures  the  output of commands. When /O is missing,  only
  20.        the commands themselves are captured.
  21.  
  22.        /-
  23.        suppresses  the storing of the closing message when  closing
  24.        a  log  file. You can then use a log file as a batch program
  25.        without  having to remove the closing message  by  hand.  It
  26.        only  makes sense if the log file was opened WITHOUT the  /O
  27.        option.
  28.  
  29.    MacDOS vs DOS
  30.        DOS does not support LOG.
  31.  
  32.    Notes
  33.        File creator
  34.        By  default,  LOG generates a file with creator 'ttxt'  (for
  35.        TeachText),  but  you can change it by  SETting  the  system
  36.        variable CREATOR.
  37.  
  38.    Frequently occurring errors
  39.        E77: File already open for writing
  40.        The  file  was already open in exclusive mode.  Perhaps  you
  41.        were already using the same file for LOGging.
  42.  
  43.  
  44. MD, MKDIR
  45.        create a folder (ie. MaKe a DIRectory).
  46.  
  47.    Syntax
  48.        md name
  49.        mkdir name
  50.  
  51.        The two commands are functionally identical.
  52.  
  53.    Parameters
  54.        name
  55.        is  the  name of the folder to be created. It can include  a
  56.        volume and path spec.
  57.  
  58.    MacDOS vs DOS
  59.        The two implementations are identical.
  60.  
  61.    Examples
  62.        Create a folder in the root directory:
  63.           mkdir \foldName
  64.        Create a subfolder of the current folder:
  65.           mkdir subFold
  66.        Create  a  folder  in  the same folder  which  contains  the
  67.        current one:
  68.           mkdir ..\sisterFold
  69.        Create a folder in the current folder of volume D:
  70.           mkdir D:newFold
  71.  
  72.    Frequently occurring errors
  73.        E58: Duplicate filename(s)
  74.        There  is already a folder or a file with the same  name  in
  75.        the same place. Remember that names are NOT case sensitive.
  76.  
  77.    See Also
  78.        RD, RMDIR, CD, CHDIR
  79.  
  80.  
  81. MEM
  82.        provides information on the list of executing processes.
  83.  
  84.    Syntax
  85.        mem
  86.  
  87.    MacDOS vs DOS
  88.        MacDOS  provides information similar to what is provided  in
  89.        DOS  by  the  command  MEM /PROGRAM .  There  are  two  main
  90.        differences:
  91.        •  MacDOS does not provide information on system globals.
  92.        •  MacDOS  provides additional information like the  creator
  93.           string and the path of the application file.
  94.  
  95.  
  96. MORE
  97.        displays  the  content  of a text file  one  page  (ie.  one
  98.        window-full) at a time.
  99.  
  100.    Syntax
  101.        more < file
  102.        chain | more
  103.  
  104.    Parameters
  105.        file
  106.        is  the  name of a text file, possibly preceded by a  volume
  107.        and  path  spec.  When file is missing, MORE  accepts  input
  108.        from the keyboard. Input can then be terminated by typing  a
  109.        cntl-Z  (that the Macintosh interprets as an EOF), a cntl-C,
  110.        or a cmd-dot.
  111.  
  112.        chain
  113.        is  a  chain  of  piped MacDOS filters,  possibly  including
  114.        parameters  and switches and beginning with  a  command.  In
  115.        its  simplest  form,  a chain simply consists  of  a  MacDOS
  116.        command that accepts output redirection.
  117.  
  118.    MacDOS vs DOS
  119.        MacDOS  does  not prompt the user at the end  of  each  page
  120.        when the output is redirected to a disk file.
  121.  
  122.        DOS only allow MORE to be preceded by a single command.
  123.  
  124.    Notes
  125.        Generating text files
  126.        You  can generate small text files by executing MORE without
  127.        parameters by redirecting its output to a disk file:
  128.           more > newFile
  129.        MORE  then  keeps storing what you type into  newFile  until
  130.        you  type a cntl-Z. If your keyboard does not have the  CNTL
  131.        key,  you can type cmd-dot instead. Nevertheless, as a  cmd-
  132.        dot  aborts the current line, you should only type it  after
  133.        the last RETURN.
  134.        This  method  of producing text files is only practical  for
  135.        batch programs of a couple of lines or small files for  test
  136.        purposes.
  137.  
  138.    Examples
  139.        more < \documents\myTextFile
  140.        myFilter < filterInput | more
  141.        dir | more
  142.        help xcopy | more
  143.        dir/b/a-d | filter1 | filter2 | more
  144.  
  145.    Frequently occurring errors
  146.        E40: Not a file of type 'TEXT'
  147.        MORE can only display text files.
  148.  
  149.    See Also
  150.        TYPE
  151.  
  152.  
  153. NEXT
  154.        terminates a multi-line FOR-loop.
  155.  
  156.    Syntax
  157.        next varname
  158.  
  159.    Parameters
  160.        varname
  161.        is the control variable of the FOR-loop.
  162.  
  163.    MacDOS vs DOS
  164.        DOS does not support NEXT.
  165.  
  166.    Notes
  167.        Jumping in and out of FORs
  168.        If  you  jump into a FOR-loop with a GOTO, MacDOS  does  not
  169.        automatically  report an error. This is partly  due  to  the
  170.        fact  that  MacDOS ignores the NEXT command if  the  control
  171.        variable does not exist. You should always enter loops  from
  172.        the  top. If a FOR-loop is exited with a GOTO before  it  is
  173.        completed,  MacDOS  "remembers"  that  the  loop   was   not
  174.        completed   and  does  not  release  the  control  variable.
  175.        Therefore,  it  is possible to jump out, do  something,  and
  176.        jump back in.
  177.        If  you  jump out of a FOR-loop and then try to  restart  it
  178.        from the beginning, MacDOS reports the error message:
  179.           Variables used in iterations must be unique
  180.        because the control variable was not released.
  181.  
  182.    See Also
  183.        FOR
  184.  
  185.  
  186. ONERROR
  187.        specifies a label for error handling in batch.
  188.  
  189.    Syntax
  190.        onerror [label]
  191.  
  192.    Parameters
  193.        label
  194.        is  a  label  from which batch execution continues  whenever
  195.        MacDOS  encounters an error. When this parameter is missing,
  196.        ONERROR resets the error handling.
  197.  
  198.    MacDOS vs DOS
  199.        DOS does not support ONERROR.
  200.  
  201.    Notes
  202.        Standard handling
  203.        After  detecting an error, MacDOS aborts the current command
  204.        and  continues  execution  of the  batch  program  from  the
  205.        following line.
  206.  
  207.        Error routine
  208.        You  can  implement an error routine by setting  a  variable
  209.        with a return label:
  210.           onerror ERR_LBL
  211.           set return_lbl=RET_LBL
  212.            if  this  line causes an error we resume execution  from
  213.        ERR_LBL
  214.          :RET_LBL
  215.           here is where we come back from the error routine
  216.           ...
  217.          :ERR_LBL
  218.             here   we  handle  the  error  before  resuming  normal
  219.        execution
  220.           goto %return_lbl%
  221.  
  222.    Examples
  223.        onerror
  224.        onerror ERR_LBL
  225.        onerror %var%
  226.  
  227.    See Also
  228.        SHOW
  229.  
  230.  
  231. OPEN
  232.        opens a text file for sequential access.
  233.  
  234.    Syntax
  235.        open [file [var]] [{/R | /W | /A}]
  236.  
  237.    Parameters
  238.        file
  239.        is  the name of a file of type 'TEXT', possibly preceded  by
  240.        a  volume and path spec. When file is missing, OPEN displays
  241.        the  list  of  files already open. After being  OPENed,  the
  242.        file  can  be accessed with the commands READ or  WRITE  and
  243.        closed with CLOSE.
  244.  
  245.        var
  246.        is  the name of the variable into which the fileID is to  be
  247.        stored.  When  var is missing, OPEN displays the  fileID  in
  248.        the MacDOS window.
  249.  
  250.    Switches
  251.        Only  one  of  /R,  /W, and /A at a time  is  allowed  in  a
  252.        command. When no switch is provided, /R is assumed.
  253.  
  254.        /R
  255.        opens  an existing text file to read (see the command READ).
  256.        If the file does not exist, OPEN fails.
  257.  
  258.        /W
  259.        opens  a new text file to write (see the command WRITE).  If
  260.        the file already exists, OPEN replaces it with the new one.
  261.  
  262.        /A
  263.        opens  an  existing text file to write past the current  EOF
  264.        (see  the  command WRITE). If the file does not exist,  OPEN
  265.        creates it.
  266.  
  267.    MacDOS vs DOS
  268.        DOS does not support OPEN.
  269.  
  270.    Notes
  271.        Forks
  272.        OPEN only sees the data fork of text files.
  273.  
  274.        Non-text files
  275.        You  can READ the data fork of a file not of type 'TEXT'  by
  276.        copying it:
  277.           COPY/D filename theCopy
  278.        and changing its type:
  279.           REN theCopy /t!TEXT
  280.        (at  this  point, you can also use TYPE and MORE to  display
  281.        it).
  282.  
  283.        Concurrent access
  284.        The  same file can be opened more than once for reading  but
  285.        only  once  for writing. This also applies to  files  opened
  286.        directly by MacDOS (eg. to read a batch program or  for  I/O
  287.        redirection)  or  by  other  applications  (compilers,  word
  288.        processors, etc.).  You should not change the content  of  a
  289.        file  while  it is being read. When you OPEN a file,  MacDOS
  290.        keeps  in memory the current file offset and has no  way  of
  291.        checking  whether  it  remains valid. Therefore,  it  is  of
  292.        particular  importance  that  the  length  of  the   portion
  293.        already READ remains unchanged.
  294.  
  295.        File reset
  296.        If  you  OPEN  a  file for writing and CLOSE it  immediately
  297.        thereafter,  this  will  have the  effect  of  removing  its
  298.        content, while leaving its creator unchanged.
  299.  
  300.    Examples
  301.        open myFile
  302.        open 2:\aFold\aFile aVar /R
  303.        open memoList saveID /a
  304.        open
  305.  
  306.    Frequently occurring errors
  307.        E27: File or directory not found
  308.        When  OPENing  for reading, the parameter did  not  identify
  309.        any  file  at  all.  Alternatively, one of  the  directories
  310.        specified in the path could not be found.
  311.  
  312.        E34: Illegal wildcarding
  313.        You  were trying to open a folder instead of a file:  MacDOS
  314.        tried  to  open  all the files contained in the  folder  and
  315.        then failed because OPEN can only open a file at a time.
  316.  
  317.        E40: Not a file of type 'TEXT'
  318.        You can only OPEN text files. Perhaps you forgot to save  it
  319.        from your word processor as "text only".
  320.  
  321.        E77: File already open for writing
  322.        The  file  to  be  OPENed for writing was  already  open  in
  323.        exclusive  mode, either by MacDOS or by another application.
  324.        Check  what  files  you have opened in your  word  processor
  325.        and/or  editor. Some applications fail to close a file  when
  326.        you  close the corresponding window (yes, it is a bug!).  In
  327.        those  cases, you will have to quit the application in order
  328.        to free the file.
  329.  
  330.    See Also
  331.        READ, WRITE, CLOSE
  332.  
  333.  
  334. PATH
  335.        displays and sets search paths for executable files.
  336.  
  337.    Syntax
  338.        path [paths]
  339.  
  340.        "PATH paths" is equivalent to "SET PATH=paths"
  341.  
  342.    Parameters
  343.        paths
  344.        is  a  list  of paths separated by semicolons. If  paths  is
  345.        missing,  PATH displays the current list. If paths  consists
  346.        of a single semicolon, PATH resets the list.
  347.  
  348.    MacDOS vs DOS
  349.        The two implementations are identical.
  350.  
  351.    Notes
  352.        Global variable PATH
  353.        MacDOS  stores the list of paths in a global system variable
  354.        named PATH. Therefore, the command
  355.           path listOfPaths
  356.        is completely equivalent to
  357.           set path=listOfPaths
  358.        Similarly,
  359.           path ;
  360.        is equivalent to
  361.           set path=
  362.  
  363.        Changing the current PATH
  364.        You  can  easily append a new folder to the current PATH  by
  365.        typing any of the following three commands:
  366.           path %path%;newFolder
  367.           set path=%path%;newFolder
  368.           incr path by ;newFolder
  369.  
  370.        Similarly,  to insert a new folder at the beginning  of  the
  371.        current PATH, you can type:
  372.           path newFolder;%path%
  373.           set path=newFolder;%path%
  374.           incr -path by newFolder;
  375.  
  376.        Also  look at the batch programs addPath.bat and delPath.bat
  377.        in the batches folder of the MacDOS floppy.
  378.  
  379.        Order of searching and multiple filenames
  380.        MacDOS  looks  for  executable files in the  current  folder
  381.        (first   without   extension,  then  after   appending   the
  382.        extensions  .BAT) before scanning the folders identified  in
  383.        the global variable PATH.
  384.  
  385.        When   looking  for  an  executable  file  or  a   file   of
  386.        abbreviations,  MacDOS scans the paths from  left  to  right
  387.        until  it  finds  a  file with the correct name.  Therefore,
  388.        when  several files with the same name are in the  different
  389.        folders of the path, MacDOS only sees the first one.
  390.  
  391.    Examples
  392.        path ;
  393.        path
  394.        path "c:\;\bin;1:\application folder;1:\batches"
  395.  
  396.  
  397. PAUSE
  398.        suspends  execution  of  a batch program  and  asks  whether
  399.        execution should be resumed.
  400.  
  401.    Syntax
  402.        pause
  403.  
  404.    MacDOS vs DOS
  405.        The two implementations are identical.
  406.  
  407.    Notes
  408.        PAUSE vs cntl-C
  409.        PAUSE  lets  you interrupt a batch program in  a  controlled
  410.        way,  while a cntl-C (or cmd-dot) interrupts batch execution
  411.        asynchronously.  After being PAUSEd,  a  batch  program  can
  412.        always  continue without problems. On the other hand, cntl-C
  413.        is   risky,   because  it  actually  interrupts   individual
  414.        commands.  When you resume execution after a cntl-C,  MacDOS
  415.        does  NOT  complete the command which was  interrupted,  but
  416.        simply continues with the next line of the batch program.
  417.  
  418.  
  419. PRINT
  420.        prints a text file.
  421.  
  422.    Syntax
  423.        print [file] [/P] [/D]
  424.  
  425.    Parameters
  426.        file
  427.        specifies  what is to be printed. It can be  a  filename,  a
  428.        wildcarded filename, or a folder name, possibly preceded  by
  429.        a  volume  and  path spec. If file is omitted, PRINT  prints
  430.        the text contained in the console window.
  431.  
  432.    Switches
  433.        /P
  434.        prompts you for confirmation before printing each file.
  435.  
  436.        /D
  437.        displays  the  standard  Print dialog  before  printing  the
  438.        file.  When  printing  a wildcarded  series  of  files,  the
  439.        dialog  is only displayed before printing the first file  of
  440.        the  series. The parameter settings are then applied to  all
  441.        following prints until you execute PRINT/D once more.
  442.  
  443.    MacDOS vs DOS
  444.        Options and parameters
  445.        MacDOS  supports none of the DOS options, but it can  prompt
  446.        you  with  the  switch  /P and /D.  Only  one  parameter  is
  447.        accepted  by MacDOS, but it can be wildcarded or  specify  a
  448.        folder.
  449.  
  450.    Notes
  451.        Page Setup and Print console menu items
  452.        The  "Page Setup..." item in the "File" menu behaves in  the
  453.        usual  way.  The "Print console..." item prints what  is  in
  454.        the MacDOS window.
  455.  
  456.        Print dialog box
  457.        By  default,  the command PRINT does not put  up  the  usual
  458.        Macintosh  dialog box. Thefeore, it lets you  print  several
  459.        text  files without having to click the mouse for  each  one
  460.        of  them.  It  normally prints one copy of each entire  file
  461.        but  you  can  change the default via the "Print console..."
  462.        item  of the "File" menu or the switch /D. MacDOS will  then
  463.        apply  the  same  settings when executing  PRINT  until  you
  464.        change them again.
  465.  
  466.        Form Feeds
  467.        When  MacDOS  encounters  a line  which  begins  with  a  FF
  468.        character  (cntl-L = 0x0C), it executes a form feed  without
  469.        printing that line.
  470.  
  471.    Examples
  472.        print "\myProject folder\sources\*.c"
  473.        print \mixedFiles /p
  474.        print "a file" /D
  475.  
  476.    Frequently occurring errors
  477.        E27: File or directory not found
  478.        The  parameter did not identify any file at all  or  one  of
  479.        the directories specified in the path could not be found.
  480.  
  481.        E40: Not a file of type 'TEXT'
  482.        You  can  only PRINT text files. Perhaps you forgot to  save
  483.        it from your word processor as "text only".
  484.  
  485.  
  486. PROMPT
  487.        changes the command prompt.
  488.  
  489.    Syntax
  490.        prompt [text]
  491.  
  492.        "PROMPT text" is equivalent to "SET PROMPT=text"
  493.  
  494.    Parameters
  495.        text
  496.        specifies what you want to have in the command prompt.  When
  497.        PROMPT  encounters in text a dollar sign, it interprets  the
  498.        following  character as a request to insert special  strings
  499.        into the command prompt. The possible requests are:
  500.           $B | (pipe)
  501.           $D current date
  502.           $E escape (ASCII code 27)
  503.           $G > (greater-than sign)
  504.           $H backspace (erases the previous character)
  505.           $L < (less-than sign)
  506.           $N current volume
  507.           $P current volume and path
  508.           $Q = (equal sign)
  509.           $T system time
  510.           $V MacDOS version number
  511.           $_ new-line
  512.           $$ $ (dollar sign)
  513.        When  text  is missing, PROMPT resets the command prompt  to
  514.        the default string ($N$G).
  515.  
  516.    MacDOS vs DOS
  517.        The two implementations are identical.
  518.  
  519.    Notes
  520.        Date and Time formats
  521.        The  date  and  time  formats are set  with  DATE  and  TIME
  522.        respectively.
  523.  
  524.        Paths and dismounted volumes
  525.        If  you EJECT a floppy while you are attached to it and your
  526.        command  prompt contains $P, you will get the error  message
  527.        "No  such volume" after every prompt. To avoid such an error
  528.        message  you  should attach to a mounted volume.  Naturally,
  529.        you could also remove the $P from the prompt string.
  530.  
  531.    Examples
  532.        command                prompt
  533.        prompt $p$g            C:\MacDOS folder>
  534.  
  535.        prompt "Now: $t$$"     Now: 13:33:16$
  536.  
  537.        prompt $d;$t$_$v !     94-09-30;13:35:10
  538.                               2.0.0 !
  539.  
  540.    See Also
  541.        DATE, TIME, VER, VOL, CD
  542.  
  543.  
  544. RD, RMDIR
  545.        delete an empty folder (ie. ReMove a DIRectory).
  546.  
  547.    Syntax
  548.        rd name
  549.        rmdir name
  550.  
  551.        The two commands are functionally identical.
  552.  
  553.    Parameters
  554.        name
  555.        is  the  name of the folder to be removed. It can include  a
  556.        volume and path spec.
  557.  
  558.    MacDOS vs DOS
  559.        The two implementations are identical.
  560.  
  561.    Notes
  562.        RMDIR vs. DEL
  563.        DEL  followed by a folder name deletes all the files in  the
  564.        folder,  while  RMDIR  followed  by  the  same  folder  name
  565.        actually removes the folder (if it is empty).
  566.  
  567.    Examples
  568.        Removes a folder from the root directory:
  569.           rmdir \foldName
  570.        Removes a subfolder of the current folder:
  571.           rmdir subFold
  572.        Removes  a  folder from the same folder which  contains  the
  573.        current one:
  574.           rmdir ..\sisterFold
  575.        Removes a folder from the current folder of volume D:
  576.           rmdir D:oldFold
  577.        Removes a folder from the root directory of volume D:
  578.           rmdir D:\aFold
  579.  
  580.    Frequently occurring errors
  581.        E49: File busy, dir non empty, or path error
  582.        RMDIR can only remove a folder if it is empty.
  583.  
  584.    See Also
  585.        MD, MKDIR, CD, CHDIR
  586.  
  587.  
  588. READ
  589.        reads a line of text from a file opened with OPEN.
  590.  
  591.    Syntax
  592.        read fileID [var]
  593.  
  594.    Parameters
  595.        fileID
  596.        is  the number returned by OPEN. The file can be closed with
  597.        the  command CLOSE, but MacDOS closes it automatically  when
  598.        it encounters the EOF.
  599.  
  600.        var
  601.        is  the name of the global variable into which the read line
  602.        is  to  be  stored. If var is omitted, MacDOS  displays  the
  603.        line in the MacDOS window.
  604.  
  605.    MacDOS vs DOS
  606.        DOS does not support READ.
  607.  
  608.    Notes
  609.        Line termination
  610.        READ  strips the newline character (CR) at the end  of  each
  611.        line  containing more than one character. If the CR  is  the
  612.        only  character  in  the line, MacDOS  replaces  it  with  a
  613.        space.  This  guarantees  that the line  returned  is  never
  614.        empty.
  615.  
  616.    Examples
  617.        read 3                reads   a   line  from  file  #3   and
  618.                               displays it on the monitor's screen.
  619.  
  620.        read %fileID% aLine   reads  a  line from the file whose  ID
  621.                               is  stored in the variable fileID and
  622.                               stores it into the variable aLine.
  623.  
  624.        read %2               reads  a  line from the file whose  ID
  625.                               was  passed to the batch program  via
  626.                               the second replaceable parameter.
  627.  
  628.    Frequently occurring errors
  629.        E3: File not opened by the user
  630.        The  file  you wanted to READ was not opened. Remember  that
  631.        MacDOS  automatically closes the file  when  you  reach  the
  632.        EOF.
  633.  
  634.    See Also
  635.        OPEN, WRITE, CLOSE
  636.  
  637.